using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using MyServices;

namespace EntryProject;

public partial class MainViewModel : ObservableObject
{
    private readonly DeviceService _deviceService;
    public MainViewModel(DeviceService deviceService)
    {
        _deviceService = deviceService;
    }
    [ObservableProperty] private string title = "多项目IOC测试";

    [ObservableProperty] private string author = "@是十六碼";

    [RelayCommand]
    public void CheckDevice()
    {
        this._deviceService.CheckDevice();
    }
    //源代码生成器
    // private string title = "多项目IOC测试";
    // 自动生成的代码（类似这样）
    // public string Title
    // {
    //     get => title;
    //     set
    //     {
    //         if (SetProperty(ref title, value))
    //         {
    //             OnPropertyChanged(nameof(Title));
    //         }
    //     }
    // }
    //只读属性
    // public string Name { get; } = "Default";
    // public string DisplayName => $"Name: {Name}";
}